import store from '@/store/index.js'

class Init {
	setUserInfo() {
		// 获取用户登录状态
		const hasLogin = uni.getStorageSync('hasLogin')
		if(hasLogin) {
			const openId = uni.getStorageSync('open_id')
			const user_id = uni.getStorageSync('user_id')
			const token = uni.getStorageSync('token')
			store.commit('SET_LOGIN',{
				openId,
				sess_id: token,
				user_id
			})
			// 获取分享二维码和用户信息
			store.dispatch('getShareCodeData')
			store.dispatch('getUserInfoData')
		}
	}
}
export default Init